#include "serialdebug.h"

SerialDebug::SerialDebug(QWidget *parent) : QWidget(parent)
{
    message_text_edit = new QTextEdit(this);
    message_text_edit->resize(800,500);
    data_check_box = new QCheckBox(this);


    QLabel * dataCheckLable = new QLabel(this);
    dataCheckLable->setText("16进制显示");
    dataCheckLable->move(820,20);
    data_check_box->move(905,20);
}
void SerialDebug::serial_debug_rec_data(QByteArray data)
{
    if(data_check_box->checkState() == Qt::Checked)
    {
        message_text_edit->setTextColor(QColor(255,12,3));
        QByteArray hexData = data.toHex(' ');
        message_text_edit->append(hexData);
    }
    else {

    }
}
void SerialDebug::serial_debug_send_data(QByteArray data)
{
    if(data_check_box->checkState() == Qt::Checked)
    {
        message_text_edit->setTextColor(QColor(0,0,0));
        QByteArray hexData = data.toHex(' ');
        message_text_edit->append(hexData);
    //qDebug()<<"------"<<hexData;

    }
    else {

    }
}
